package jdbc;

import jdbc.fanshe.My_JDBC_Crud;

import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

public class TestJdbc {
    public static void main(String[] args) throws SQLException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
//        System.out.println("My_JDBC_Crud.getConnection() = " + My_JDBC_Crud.getConnection());

//        int i = My_JDBC_Crud.updata1("update user set nickname=? where id=?", "远野贵树", 5);
//        System.out.println("i = " + i);

//        ArrayList<user> user = My_JDBC_Crud.queryBeanList("select * from user where id=?", user.class, 3);
//        System.out.println("user = " + user);

//        Map<String, Object> aaa = My_JDBC_Crud.queryMap("select * from user", null);
//        System.out.println("aaa = " + aaa);

//        ArrayList<Map> maps = My_JDBC_Crud.queryMapList("select * from user", null);
//        System.out.println("aaa = " + maps);

//        Object[] aas = My_JDBC_Crud.queryArray("select * FROM user", null);
//        System.out.println("aas = " + aas);
//        for (int i = 0; i < aas.length; i++) {
//            for (Object o : aas) {
//                System.out.println("o = " + o);
//            }
//        }
        List<Object[]> objects = My_JDBC_Crud.queryArrayList("select * from user", null);
        for (int i = 0; i < objects.size(); i++) {
            for (int j = 0; j < objects.get(i).length; j++) {
                System.out.println("objects.get(i)[j] = " + objects.get(i)[j]);
            }
            System.out.println("------------");
        }
    }
}